package com.example.wan_android.db

import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query


@Dao
interface SearchHistoryDao {
    @Insert
    fun insert(searchHistory: SearchHistoryTable)

    @Query("delete from search_history_table where id=:id")
    fun delete(id: Int)

    @Query("select * from search_history_table ORDER BY id desc")
    fun selectAll(): LiveData<List<SearchHistoryTable>>

    @Query("select * from search_history_table where id = :id")
    fun selectById(id: Int): SearchHistoryTable

    @Query("delete from search_history_table")
    fun deleteAll()
}